package thread;

public class Demo16 {
    public static void main(String[] args) throws InterruptedException {
        Thread mainThread = Thread.currentThread();

        Thread t1 = new Thread(()->{
            try {
                System.out.println("开始等待 main");
                mainThread.join();//t1线程等待main线程
                System.out.println("结束等待 main");
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        t1.start();

        Thread.sleep(3000);
        System.out.println("main end");
    }
}
